<?php 
$pdo=new PDO('mysql:host=127.0.0.1;dbname=curd','root','root');
$sql="select * from weather";
$data=$pdo->query($sql)->fetchAll();
 ?>


<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
	<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
	<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>	
</head>
<body>
<table class="table table-bordered">
  <thead>
    <tr>
      <th scope="col">序号</th>
      <th scope="col">日期</th>
      <th scope="col">星期</th>
      <th scope="col">城市</th>
      <th scope="col">天气</th>
      <th scope="col" class="text-danger">最高温度</th>
      <th scope="col">操作</th>
    </tr>
  </thead>
  <?php foreach ($data as $key => $value) :?>
  <tbody>
    <tr>
      <th scope="row"><?=$value['id']?></th>
      <td><?=$value['days']?></td>
      <td><?=$value['week']?></td>
      <td><?=$value['city']?></td>
      <td><?=$value['weather']?></td>
      <td><?=$value['temperature']?></td>
      <td><a href="">删除|修改</a></td>
    </tr>
  </tbody>
<?php endforeach ?>
</table>
</body>
</html>